package com.ys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ys.mapper.UserMoneyLogMapper;
import com.ys.pojo.TradeUserMoneyLog;
import com.ys.service.UserMoneyLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;



@Service
public class UserMoneyLogServiceImpl implements UserMoneyLogService {

    @Lazy
    @Autowired
    private UserMoneyLogMapper userMoneyLogMapper;

    @Override
    public Integer findMonerLogType(TradeUserMoneyLog userMoneyLog) {
        QueryWrapper<TradeUserMoneyLog> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(TradeUserMoneyLog::getUserId,userMoneyLog.getUserId())
                .eq(TradeUserMoneyLog::getOrderId,userMoneyLog.getOrderId());

        return userMoneyLogMapper.selectCount(queryWrapper);
    }

    @Override
    public void save(TradeUserMoneyLog userMoneyLog) {
        userMoneyLogMapper.insert(userMoneyLog);
    }


}
